package com.yanqu.road.server.cmd.union.cross;

import com.yanqu.road.pb.union.cross.CrossUnionProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.union.CrossUnionMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_UNION_CONSTRUCTION, desc = "建设联盟")
public class CrossConstructUnionCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        CrossUnionProto.UnionConstructionCrossReqMsg reqMsg = CrossUnionProto.UnionConstructionCrossReqMsg.parseFrom(packet.getBytes());


        MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.S_UNION_CONSTRUCTION_FROM_CROSS,
                CrossUnionMgr.constructUnion(packet.getPlayerId(), reqMsg.getConstructionType(), reqMsg.hasConsume() ? reqMsg.getConsume() : "")));


    }

    @Override
    public void sendData() {

    }
}
